package offer;

public class offerII_0052 {

    public TreeNode increasingBST(TreeNode root) {
        TreeNode head=new TreeNode(0);
        TreeNode[] list=new TreeNode[1];
        list[0]=head;
        build(root,list);
        return head.right;
    }
    public void build(TreeNode node,TreeNode[] list){
        if(node==null) return ;
        build(node.left,list);
        list[0].right=new TreeNode(node.val);
        list[0]=list[0].right;
        build(node.right,list);
    }
}
